<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise API - reject</title>
</head>
<body>
    <script>
        /****
         *   
         *   Promise.reject 方法(属于Promise函数对象,用于快速返回一个失败的Promise对象): (reason) => {}
         *   (1) reason: 失败的原因
         *   说明: 返回一个失败的 promise 对象 
         ***/

         let p = Promise.reject(521);
         console.log(p);

         let p2 = Promise.reject('iloveyou');
         console.log(p2);

         let p3=Promise.reject(new Promise((resolve,reject)=>{
                resolve('ok');
         }));
         console.log(p3);//状态是rejected状态,结果是一个成功的Promise对象

    </script>
</body>
</html>